# == Schema Information
#
# Table name: articles
#
#  id         :integer          not null, primary key
#  title      :string
#  text       :text
#  created_at :datetime         not null
#  updated_at :datetime         not null
#  tags_count :integer
#

class Article < ApplicationRecord
  has_many :comments, dependent: :destroy
  has_and_belongs_to_many :tags, counter_cache: :articles_count
  validates :title, presence: true,
            length: {minimum: 5}
end
